package cn.bone.demo01;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.LineBasedFrameDecoder;
import io.netty.handler.codec.string.StringDecoder;

/**
 * Created by Administrator on 2018/1/29.
 */
public class ChildChannelHandler extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {
        //解码器
        //基于换行符号
        socketChannel.pipeline().addLast(new LineBasedFrameDecoder(1024));
        //解码转string
        socketChannel.pipeline().addLast(new StringDecoder());

        //在管道中添加我们自己的接收数据实现方法
        socketChannel.pipeline().addLast(new TimeServerHandler());
    }
}
